﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ConvertAll</title>
     <script src="../../Scripts/jquery-1.4.1.min.js"></script>
     <script language="javascript" type="text/javascript">
         $(document).ready(function () {
             //document.write('code produce  automatic');
             $.ajax({
                 type: 'POST',
                 url: '<%=Url.Action("GetConnectionString","CodeProduce") %>',
                 data: '',
                 dataType: 'json',
                 success: function (ret) { $('#txt_ConnectString').val(ret.con); },
                 error: function () { }
             });

             //生产实体类
             $('#btnModel').bind('click', function () {
                 $.ajax({
                     type: 'POST',
                     url: '<%=Url.Action("CreateMode","CodeProduce") %>',
                     data: { strNameSpace: $('#txtnamespace').val() },
                     dataType: 'json',
                     success: function (ret) { var shtml = ""; for (var i = 0; i < ret.length; i++) { shtml += ret[i] + "<br/>"; } $('#result').append(shtml) },
                     error: function () { }
                 });
                 $('#result').append('<hr/>');
             });
             $('#btnDBAccess').bind('click', function () {
                 $.ajax({
                     type: 'POST',
                     url: '<%=Url.Action("CreateDBAccess","CodeProduce") %>',
                     data: { strNameSpace: $('#txtnamespace').val() },
                     dataType: 'json',
                     success: function (ret) { var shtml = ""; for (var i = 0; i < ret.length; i++) { shtml += ret[i] + "<br/>"; } $('#result').append(shtml) },
                     error: function () { }
                 });
                 $('#result').append('<hr/>');
             });
             $('#btnBussiness').bind('click', function () {
                 $.ajax({
                     type: 'POST',
                     url: '<%=Url.Action("CreateBussiness","CodeProduce") %>',
                     data: { strNameSpace: $('#txtnamespace').val() },
                     dataType: 'json',
                     success: function (ret) { var shtml = ""; for (var i = 0; i < ret.length; i++) { shtml += ret[i] + "<br/>"; } $('#result').append(shtml) },
                     error: function () { }
                 });
                 $('#result').append('<hr/>');
             });
         })
     </script>
</head>
<body>
    <div>
        <br />
        数据库连接：<input name="txt_ConnectString" type="text" value="Data Source=127.0.0.1\sql2005;Initial Catalog=sslim;User ID=sa;Password=1234" id="txt_ConnectString" style="width:500px;" />
        <br/>
        命名空间：<input name="txtnamespace" type="text" id="txtnamespace" />
        <br/>

        <input type="submit" name="btnModel" value="生成实体类" id="btnModel" />&nbsp;
        <input type="submit" name="btnDBAccess" value="生成数据库访问层" id="btnDBAccess" />
        <input type="submit" name="btnBussiness" value="生成业务逻辑层" id="btnBussiness" />
    </div>
        <input id="verifycode" class="input-code" type="text" maxlength="4" />       
     <img id="verifycode-img"  class="middle hide" align="absbottom" src="<%=Url.Action("verifyimage","Home")%>" width="130" height="53" alt="点击刷新" />&nbsp;&nbsp;   
    
    <div id="result"></div>
</body>
</html>
